from flask import Flask
from werkzeug.routing.converters import BaseConverter


app = Flask(__name__)

app.config['debug'] = True

class RegexConverter(BaseConverter):
    def __init__(self, map, *args, **kwargs):
        super().__init__(map, *args, **kwargs)
        self.regex = args[0]

app.url_map.converters['re'] = RegexConverter

@app.route("/sms/<re('1[3-9]\d{9}'):mobile>")
def sms(mobile):
    return f"发送短信给手机号：{mobile}的用户"

if __name__ == '__main__':
    app.run(host='0.0.0.0',port=5000)